import Vue from 'vue'
import Vuex from 'vuex'

Vue.use(Vuex)

const state = {
	systemInfo:{
	    screenWidth:0 ,
		screenHeight:0 ,
		windowWidth: 0,
		windowHeight: 0,
		windowTop: 0,
		windowBottom: 0,
		statusBarHeight: 0,
	}
}

const mutations = {
	changeSystemInfo(state){
	    uni.getSystemInfo({
	        success: function (res) {
				state.systemInfo.screenWidth = res.screenWidth;
				state.systemInfo.screenHeight = res.screenHeight;
				state.systemInfo.windowWidth = res.windowWidth;
				state.systemInfo.windowHeight = res.windowHeight;
				state.systemInfo.windowTop = res.windowTop;
				state.systemInfo.windowBottom = res.windowBottom;
				state.systemInfo.statusBarHeight = res.statusBarHeight;
	        }
	    });
	}
}

//异步更新
const action = {
	
}

const getters = {
	
}

export default new Vuex.Store({
	state,
	mutations,
	action,
	getters
})